# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=qt5-qtscxml
pkgver=5.15.5_git20220519
pkgrel=0
_commit="bb5d10f926c51aa462a56ffb331afd4f9607855c"
# armhf blocked by qt5-qtdeclarative
arch="all !armhf"
url="https://www.qt.io/developers/"
license="LGPL-2.1-only AND LGPL-3.0-only AND GPL-3.0-only AND Qt-GPL-exception-1.0"
pkgdesc="Static and runtime integration of SCXML models into Qt code"
makedepends="
	qt5-qtbase-dev
	qt5-qtdeclarative-dev
	"
subpackages="$pkgname-dev $pkgname-doc"
builddir="$srcdir/qtscxml-$_commit"

case $pkgver in
	*_beta*|*_rc*) _rel=development_releases;;
	*) _rel=official_releases;;
esac

source="https://invent.kde.org/qt/qt/qtscxml/-/archive/$_commit/qtscxml-$_commit.tar.gz"

prepare() {
	default_prepare

	# We need to make the build system think we're running in a git repository
	# so it correctly symlinks during the build
	mkdir .git
}

build() {
	qmake-qt5
	make
}

check() {
	make check
}

package() {
	make INSTALL_ROOT="$pkgdir" install

	# Drop QMAKE_PRL_BUILD_DIR because reference the build dir
	find "$pkgdir/usr/lib" -type f -name '*.prl' \
		-exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;

	install -d "$pkgdir"/usr/share/licenses
	ln -s /usr/share/licenses/qt5-base "$pkgdir"/usr/share/licenses/$pkgname
}
sha512sums="
2cfc765c60643e4db9b35b28c5c0c45a2bc004db0a6596540c40a8066044d9454a29b1246aab0c33f447794f27e9d905395ff3521f77eab2b6bfca129bb272f7  qtscxml-bb5d10f926c51aa462a56ffb331afd4f9607855c.tar.gz
"
